using System;
using System.Windows.Input;
using SalesPoint.Commands;
using Xtensive.Orm;

namespace SalesPoint.ViewModels
{
  public class CommandViewModel : ViewModelBase
  {
    private readonly Action command;
    private readonly Func<bool> canExecuteCommand;

    public ICommand Command { get; private set; }

    public string DisplayName { get; private set; }

    public CommandViewModel(Session session, string displayName, Action command, Func<bool> canExecuteCommand) : base(session)
    {
      this.command = command;
      this.canExecuteCommand = canExecuteCommand;
      DisplayName = displayName;
      Command = new DelegateCommand(this.command, this.canExecuteCommand);
    }
  }
}
